tools/libxc: misc: Mark const the parameter 'keys' of xc_send_debug_keys()
authorJulien Grall <jgrall@amazon.com>
Mon, 30 Mar 2020 19:21:52 +0000 (20:21 +0100)
committerJulien Grall <jgrall@amazon.com>
Wed, 1 Apr 2020 09:56:01 +0000 (10:56 +0100)
commit2b8079610ec55413613ad071cc81cd9f97232a7e
tree8f5f6f3ba40a63ea40c5c99d8776a2eeb4066314
parentc4336b0b1a35c1a54a21c0cafad39466613a714f
tools/libxc: misc: Mark const the parameter 'keys' of xc_send_debug_keys()

OCaml is using a string to describe the parameter 'keys' of
xc_send_debug_keys(). Since Ocaml 4.06.01, String_val() will return a
const char * when using -safe-string. This will result to a build
failure because xc_send_debug_keys() expects a char *.

The function should never modify the parameter 'keys' and therefore the
parameter should be const. Unfortunately, this is not directly possible
because DECLARE_HYPERCALL_BOUNCE() is expecting a non-const variable.

A new macro DECLARE_HYPERCALL_BOUNCE_IN() is introduced and will take
care of const parameter. The first user will be xc_send_debug_keys() but
this can be used in more place in the future.

Reported-by: Dario Faggioli <dfaggioli@suse.com>
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxc/include/xenctrl.h
tools/libxc/xc_misc.c
tools/libxc/xc_private.h